const arr = [1, [2, [3, [4, 5]]], 6];
const arrOject = [{ a: 1 }, [{ b: 2 }, [{ d: 4 }]], { c: 3 }]
function flatten(arr) {
    let array = [];
    for (let i = 0; i < arr.length; i++) {
        if (Array.isArray(arr[i])) {
            flatten(arr[i]);
        } else {
            array.push(arr[i]);
        }
    }
    return array;
}
console.log(arrOject.flat(Infinity));
